﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="LogisticsVision.Prototype.JsRemoteInvoke.Inventory.Portal.Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <link type="text/css" rel="Stylesheet" href="StyleSheet/Stylesheet.css" />
    <script type="text/javascript">
        var executeMode;
        
        function OnError(result) {
            alert("Error");
        }

        function OnRequestComplete(result) {
            alert(result);
        }

        // namespace equals [ServiceContract(Namespace = "Inventory")]
        function Add_onclick() {
            var x = document.getElementById("txtX").value;
            var y = document.getElementById("txtY").value;
            if (executeMode == "WCF")
                Inventory.Wcf.CalculatorWcfService.Add(x, y, OnRequestComplete, OnError);
            else
                LogisticsVision.Prototype.JsRemoteInvoke.Inventory.Portal.CalculatorWSService.Add(x, y, OnRequestComplete, OnError);
        }

        function Multiple_onclick() {
            var x = document.getElementById("txtX").value;
            var y = document.getElementById("txtY").value;
            if (executeMode == "WCF")
                Inventory.Wcf.CalculatorWcfService.Multiple(x, y, OnRequestComplete, OnError);
            else
                LogisticsVision.Prototype.JsRemoteInvoke.Inventory.Portal.CalculatorWSService.Multiple(x, y, OnRequestComplete, OnError);
        }

        function lstMode_onchange() {
            executeMode = document.getElementById("lstMode").value;
        }

        function window_onload() {
            executeMode = document.getElementById("lstMode").value;
        }

    </script>
    <style type="text/css">
        #Select1
        {
            width: 235px;
        }
    </style>
</head>
<body onload="return window_onload()">
    <form id="form1" runat="server" onsubmit="return false;">
    <div>
        <asp:ScriptManager ID="ScriptManager1" runat="server">
            <Services>
                <%-- WCF --%>
                <asp:ServiceReference Path="~/CalculatorWcfService.svc" />                  
                <%-- Web Service --%>
                <asp:ServiceReference Path="~/CalculatorWSService.asmx" />
            </Services>
        </asp:ScriptManager>
    </div>
    <br />
    <div>
        <select id="lstMode" onchange="return lstMode_onchange()">
            <option value="WCF">WCF</option>
            <option value="WS" >Web Service</option>
        </select>
        <input type="text" id="txtX" />
        <input type="button" id="Add" value="Add" onclick="return Add_onclick()" />
        <input type="button" id="Multiple" value="Multiple" onclick="return Multiple_onclick()" />
        <input type="text" id="txtY" />&nbsp;
    </form>
</body>
</html>
